﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ThreadModule.Data
{
    /// <summary>
    /// 螺纹参数类
    /// </summary>
    public class ThreadParameters
    {
        /// <summary>
        /// 是否为名义值
        /// </summary>
        public bool isNominalValues { get; set; }

        /// <summary>
        /// 螺距
        /// </summary>
        public double pitch{ get; set; }

        /// <summary>
        /// 中径
        /// </summary>
        public double pitchDiameter { get; set; }

        /// <summary>
        /// 大径
        /// </summary>
        public double majorDiameter { get; set; }

        /// <summary>
        /// 小径
        /// </summary>
        public double minorDiameter { get; set; }

        /// <summary>
        /// 左牙侧角
        /// </summary>
        public double leftHalfAngle { get; set; }

        /// <summary>
        /// 右牙侧角
        /// </summary>
        public double rightHalfAngle { get; set; }

        /// <summary>
        /// 全角
        /// </summary>
        public double fullAngle { get; set; }

        /// <summary>
        /// 锥度值
        /// </summary>
        public double? taper { get; set; }

        /// <summary>
        /// 参考距离
        /// </summary>
        public double? referenceDistance { get; set; }

        /// <summary>
        /// 输出计算信息
        /// </summary>
        [Conditional("DEBUG")]
        public void Dump()
        {
            if (isNominalValues)
            {
                Console.WriteLine("\n名义值：");
            }
            else
            {
                Console.WriteLine("\n实测值：");
            }
            string json = JsonConvert.SerializeObject(this, Formatting.Indented);
            Console.WriteLine(json);
        }
    }
}
